package com.yupi.tangoj.codebox.design;

import com.yupi.tangoj.codebox.CodeSandBox;
import com.yupi.tangoj.codebox.impl.CodeSandBoxByApi;
import com.yupi.tangoj.codebox.impl.CodeSandBoxByCommon;
import com.yupi.tangoj.codebox.impl.CodeSandBoxByRPC;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

@Component
@Slf4j
public class SandBoxFactory{

    public static CodeSandBox createCodeSanBox(String type) {

        log.info(type);

        if ("comm".equals(type)){
            return new CodeSandBoxByCommon();
        }else if ("api".equals(type)){
            return new CodeSandBoxByApi();
        }else if ("rpc".equals(type)){
            return new CodeSandBoxByRPC();
        }

        return new CodeSandBoxByCommon();
    }
}
